from Data import Son
from sqlalchemy import and_, or_

son_all = Son.query.all()

print(son_all)
for son in son_all:
    print(son)
    print(son.id)
    # print(type(son))  # <class 'Data.Son'>

# 数据查询过滤
son = Son.query.filter(and_(Son.name == "cmy", Son.id == 1)).all()
print("查询结果: " + str(son[0]))
print(son[0].father.name)  # 关联查询
